<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String basePath = request.getContextPath();
%>
<script type="text/javascript">
	
	var selectedRes = new Array();

	$(document).ready(function(){
		
		$("input[name='resources']").bind("click",function(){
			
			var $this = $(this);
			
			if($this.attr("checked") == "checked"){
				
				selectedRes.push($this.val());
				
			}else{
				
				selectedRes.removeValue($this.val());

			}
			
			$("#roleResourceStr").val(selectedRes.join(","));
		});
	});
</script>

<form id="pagerForm" method="post" action="<%=basePath%>/role/toRoleAdd.action">
	<input type="hidden" name="page.curPage" value="<s:property value="#PAGE_LIST.curPage"/>" />
	<input type="hidden" name="page.pageSize" value="<s:property value="#PAGE_LIST.pageSize"/>" />
</form>

<div class="pageContent">

	<form method="post" action="<%=basePath%>/role/roleAdd.action" class="pageForm required-validate" onsubmit="return validateCallback(this,dialogAjaxDone,'确认添加此角色信息?')">
		
		<!-- 页面字段值 -->
		<div class="pageFormContent">
			<div class="unit">
				<label>角色名称：</label> <input type="text" id="rolesName" name="roles.rolesName" class="required"/>
			</div>

			<div class="unit">
				<label>角色代码：</label> <input type="text" id="rolesCode" name="roles.rolesCode" class="required"/>
			</div>
			
			<input type="hidden" id="roleResourceStr" name="roleResourceStr">
			
		</div>
		
		<div class="formBar">
			<ul>
				<li><div class="buttonActive">
						<div class="buttonContent">
							<button type="submit">提交</button>
						</div>
					</div></li>
				<li><div class="button">
						<div class="buttonContent">
							<button type="button" class="close">取消</button>
						</div>
				</div></li>
			</ul>
		</div>
	</form>
	
	<table class="list" layoutH="140" width="100%" targetType="navTab">
		<thead>
			<tr>
				<th width="10"><input type="checkbox" group="resources" class="checkboxCtrl"></th>
				<th width="200">资源名称</th>
				<th width="100">资源链接</th>
				<th width="100">资源状态</th>
				<th width="80">资源编号</th>
				<th width="100">资源创建时间</th>
			</tr>
		</thead>
		<tbody>
			<s:iterator value="#request['RESOURCES_INFO']" id="res">
				<tr>
					<td><input type="checkbox" name="resources" value="<s:property value="#res.resId"/>"></td>
					<td><s:property value="#res.resName"/></td>
					<td><s:property value="#res.resAction"/></td>
					<td><s:text name="resources.status.%{#res.resStatus}"/></td>
					<td><s:property value="#res.resNodeNum"/></td>
					<td><s:date name="#res.resCreateTimeFormat" format="yyyy-MM-dd"/></td>
				</tr>
			</s:iterator>
		</tbody>
	</table>
	<%@include file="/WEB-INF/page/common/pagination.jsp"%>
</div>